const path = require('path');
const baseConfig = require('./webpack.base.conf.js');
const { merge } = require('webpack-merge');

module.exports = merge(baseConfig, {
  mode: 'development',
  module: {
    rules: [
      {
        oneOf: [
          {
            test: /\.css$/,
            use: [
              'style-loader',
              'css-loader',
              {
                loader: 'postcss-loader',
                options: {
                  postcssOptions: {
                    // 配置要使用的插件
                    plugins: [
                      'postcss-preset-env'
                    ]
                  }
                }
              }
            ]
          },
          {
            test: /\.less$/,
            use: [
              'style-loader',
              'css-loader',
              {
                loader: 'postcss-loader',
                options: {
                  postcssOptions: {
                    // 配置要使用的插件
                    plugins: [
                      'postcss-preset-env'
                    ]
                  }
                }
              },
              'less-loader'
            ]
          }
        ]
      }
    ]
  },
  devServer: {
    port: 3000,
    host: 'localhost',
    compress: true,
    contentBase: path.resolve(__dirname, '../dist'),
    hot: true,
    open: true
  },
  plugins: [

  ],
  devtool: 'source-map'
})